<%-- 
    Document   : menuleft
    Created on : 17-10-2011, 19:57:16
    Author     : VuTienIT
--%>

<%@page import="model.pojo.*"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
KhachHangPOJO ssDangNhap = null;
if(session.getAttribute("KhachHang")==null)
{
    ssDangNhap = new KhachHangPOJO();
    session.setAttribute("KhachHang", ssDangNhap);
}
else
{
    ssDangNhap = (KhachHangPOJO)session.getAttribute("KhachHang");
}
%>
<!DOCTYPE html>
<div class="templatemo_sidebar">
                
    <div class="sidebar_box">
 
        <h2>Danh mục</h2>
        <div class="sidebar_box_content">

            <ul class="categories_list">
                <% ArrayList<DanhMucPOJO> ds = (ArrayList<DanhMucPOJO>) request.getAttribute("DanhMucS");
                   for(int i=0;i<ds.size();i++)
                   {
                       DanhMucPOJO lg = ds.get(i);
                %>
                <li><a href="home?Page=View&MaDanhMuc=<%=lg.getMaDanhMuc()%>"><%=lg.getTenDanhMuc()%></a></li>    
                <%
                   }
                %>
            </ul>

         </div>

    </div>

    <div class="sidebar_box">
<h2>Khách hàng</h2>
                    
        <div class="sidebar_box_content">
            <div class="news_box">
                <div id="login_box">
                    <%
                    if(ssDangNhap.getTenTruyCap()==null){
                    %>
                      <table width="100%" border="0">
                        <tr>
                            <td align="center">
                                <label>
                                <a href="DangNhap" >Đăng nhập</a>
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <label>
                                <a href="DangKy" >Đăng ký</a>
                                </label>
                            </td>
                        </tr>

                      </table>
                    <%
                   } else {
                    %>
                    <h4>Xin chào <a href="ThongTinKH?Page=info" /><b><%=ssDangNhap.getTenTruyCap()%></b></a></h4>
                    <h4><a href="DangNhap?Action=Logout"/>Đăng xuất</a></h4>
                    <%
                   }
                    %>
                </div>        
            </div>  
        </div> 
    </div>
            
    <div class="sidebar_box">

        <h2>Khuyến mãi</h2>

  <div class="sidebar_box_content">
<%
//String para1 = (String) request.getAttribute("Para1");
ArrayList<PhieuPOJO> dsPhieu = (ArrayList<PhieuPOJO>) request.getAttribute("PhieuKM");
if(!dsPhieu.isEmpty())
{
    for(int i=0;i<dsPhieu.size();i++)
    {
        PhieuPOJO gg = new PhieuPOJO();
        gg = dsPhieu.get(i);
%>
    <div class="news_box">
      <a href="ChiTietSanPham?MaPhieu=<%= gg.getMaPhieu() %>"><img src="HinhAnh/HinhChinh/<%=gg.getHinhChinh()%>" width="160" height="120" /></a>

          <p><%=gg.getTenPhieu()%></p>
          <div class="discount">Đã mua <span class="style2"><%=gg.getSoLuongMua()%></span> lượt</div>

            <div class="discount">Giảm <span><%=gg.getGiamGia()%>%</span> | <a href="ChiTietSanPham?MaPhieu=<%= gg.getMaPhieu() %>">Chi tiết</a></div>

                <div class="cleaner"></div>
    </div>
                <p>&nbsp;</p>
<%
    }
}                 
%>

        </div>

  </div>      

</div>
